package com.zycfc.zsf.boot.redis.autoconfigure;

import org.springframework.boot.context.properties.*;
import org.springframework.stereotype.*;
import org.springframework.core.env.*;
import org.springframework.beans.factory.annotation.*;
import javax.annotation.*;
import org.slf4j.*;

@ConfigurationProperties(prefix = "zsf.boot.redis")
@Component
public class RedisProperties
{
    private static final Logger log;
    @Autowired
    private Environment env;
    public static final String PREFIX = "zsf.boot.redis";
    private boolean enabled;
    @Value("${zsf.all.namespace:dev}")
    private String namespace;
    private boolean namespaceEnable;
    private String nodes;
    private Integer timeout;
    private Integer maxAttempts;
    private String password;
    private int slowLogSlowerThan;
    private String extNodes;
    private String extPassword;
    
    @PostConstruct
    public void init() {
        if (this.namespaceEnable && null != this.env && (null == this.namespace || this.namespace.trim().length() == 0)) {
            this.namespace = "dev";
        }
        RedisProperties.log.info("****namespace=" + this.namespace);
    }
    
    public RedisProperties() {
        this.enabled = true;
        this.namespaceEnable = true;
        this.timeout = 5;
        this.maxAttempts = 1;
        this.slowLogSlowerThan = 10;
    }
    
    public Environment getEnv() {
        return this.env;
    }
    
    public boolean isEnabled() {
        return this.enabled;
    }
    
    public String getNamespace() {
        return this.namespace;
    }
    
    public boolean isNamespaceEnable() {
        return this.namespaceEnable;
    }
    
    public String getNodes() {
        return this.nodes;
    }
    
    public Integer getTimeout() {
        return this.timeout;
    }
    
    public Integer getMaxAttempts() {
        return this.maxAttempts;
    }
    
    public String getPassword() {
        return this.password;
    }
    
    public int getSlowLogSlowerThan() {
        return this.slowLogSlowerThan;
    }
    
    public String getExtNodes() {
        return this.extNodes;
    }
    
    public String getExtPassword() {
        return this.extPassword;
    }
    
    public void setEnv(final Environment env) {
        this.env = env;
    }
    
    public void setEnabled(final boolean enabled) {
        this.enabled = enabled;
    }
    
    public void setNamespace(final String namespace) {
        this.namespace = namespace;
    }
    
    public void setNamespaceEnable(final boolean namespaceEnable) {
        this.namespaceEnable = namespaceEnable;
    }
    
    public void setNodes(final String nodes) {
        this.nodes = nodes;
    }
    
    public void setTimeout(final Integer timeout) {
        this.timeout = timeout;
    }
    
    public void setMaxAttempts(final Integer maxAttempts) {
        this.maxAttempts = maxAttempts;
    }
    
    public void setPassword(final String password) {
        this.password = password;
    }
    
    public void setSlowLogSlowerThan(final int slowLogSlowerThan) {
        this.slowLogSlowerThan = slowLogSlowerThan;
    }
    
    public void setExtNodes(final String extNodes) {
        this.extNodes = extNodes;
    }
    
    public void setExtPassword(final String extPassword) {
        this.extPassword = extPassword;
    }
    
    @Override
    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        }
        if (!(o instanceof RedisProperties)) {
            return false;
        }
        final RedisProperties other = (RedisProperties)o;
        if (!other.canEqual(this)) {
            return false;
        }
        final Object this$env = this.getEnv();
        final Object other$env = other.getEnv();
        Label_0065: {
            if (this$env == null) {
                if (other$env == null) {
                    break Label_0065;
                }
            }
            else if (this$env.equals(other$env)) {
                break Label_0065;
            }
            return false;
        }
        if (this.isEnabled() != other.isEnabled()) {
            return false;
        }
        final Object this$namespace = this.getNamespace();
        final Object other$namespace = other.getNamespace();
        Label_0115: {
            if (this$namespace == null) {
                if (other$namespace == null) {
                    break Label_0115;
                }
            }
            else if (this$namespace.equals(other$namespace)) {
                break Label_0115;
            }
            return false;
        }
        if (this.isNamespaceEnable() != other.isNamespaceEnable()) {
            return false;
        }
        final Object this$nodes = this.getNodes();
        final Object other$nodes = other.getNodes();
        Label_0165: {
            if (this$nodes == null) {
                if (other$nodes == null) {
                    break Label_0165;
                }
            }
            else if (this$nodes.equals(other$nodes)) {
                break Label_0165;
            }
            return false;
        }
        final Object this$timeout = this.getTimeout();
        final Object other$timeout = other.getTimeout();
        Label_0202: {
            if (this$timeout == null) {
                if (other$timeout == null) {
                    break Label_0202;
                }
            }
            else if (this$timeout.equals(other$timeout)) {
                break Label_0202;
            }
            return false;
        }
        final Object this$maxAttempts = this.getMaxAttempts();
        final Object other$maxAttempts = other.getMaxAttempts();
        Label_0239: {
            if (this$maxAttempts == null) {
                if (other$maxAttempts == null) {
                    break Label_0239;
                }
            }
            else if (this$maxAttempts.equals(other$maxAttempts)) {
                break Label_0239;
            }
            return false;
        }
        final Object this$password = this.getPassword();
        final Object other$password = other.getPassword();
        Label_0276: {
            if (this$password == null) {
                if (other$password == null) {
                    break Label_0276;
                }
            }
            else if (this$password.equals(other$password)) {
                break Label_0276;
            }
            return false;
        }
        if (this.getSlowLogSlowerThan() != other.getSlowLogSlowerThan()) {
            return false;
        }
        final Object this$extNodes = this.getExtNodes();
        final Object other$extNodes = other.getExtNodes();
        Label_0326: {
            if (this$extNodes == null) {
                if (other$extNodes == null) {
                    break Label_0326;
                }
            }
            else if (this$extNodes.equals(other$extNodes)) {
                break Label_0326;
            }
            return false;
        }
        final Object this$extPassword = this.getExtPassword();
        final Object other$extPassword = other.getExtPassword();
        if (this$extPassword == null) {
            if (other$extPassword == null) {
                return true;
            }
        }
        else if (this$extPassword.equals(other$extPassword)) {
            return true;
        }
        return false;
    }
    
    protected boolean canEqual(final Object other) {
        return other instanceof RedisProperties;
    }
    
    @Override
    public int hashCode() {
        final int PRIME = 59;
        int result = 1;
        final Object $env = this.getEnv();
        result = result * 59 + (($env == null) ? 43 : $env.hashCode());
        result = result * 59 + (this.isEnabled() ? 79 : 97);
        final Object $namespace = this.getNamespace();
        result = result * 59 + (($namespace == null) ? 43 : $namespace.hashCode());
        result = result * 59 + (this.isNamespaceEnable() ? 79 : 97);
        final Object $nodes = this.getNodes();
        result = result * 59 + (($nodes == null) ? 43 : $nodes.hashCode());
        final Object $timeout = this.getTimeout();
        result = result * 59 + (($timeout == null) ? 43 : $timeout.hashCode());
        final Object $maxAttempts = this.getMaxAttempts();
        result = result * 59 + (($maxAttempts == null) ? 43 : $maxAttempts.hashCode());
        final Object $password = this.getPassword();
        result = result * 59 + (($password == null) ? 43 : $password.hashCode());
        result = result * 59 + this.getSlowLogSlowerThan();
        final Object $extNodes = this.getExtNodes();
        result = result * 59 + (($extNodes == null) ? 43 : $extNodes.hashCode());
        final Object $extPassword = this.getExtPassword();
        result = result * 59 + (($extPassword == null) ? 43 : $extPassword.hashCode());
        return result;
    }
    
    @Override
    public String toString() {
        return "RedisProperties(env=" + this.getEnv() + ", enabled=" + this.isEnabled() + ", namespace=" + this.getNamespace() + ", namespaceEnable=" + this.isNamespaceEnable() + ", nodes=" + this.getNodes() + ", timeout=" + this.getTimeout() + ", maxAttempts=" + this.getMaxAttempts() + ", password=" + this.getPassword() + ", slowLogSlowerThan=" + this.getSlowLogSlowerThan() + ", extNodes=" + this.getExtNodes() + ", extPassword=" + this.getExtPassword() + ")";
    }
    
    static {
        log = LoggerFactory.getLogger((Class)RedisProperties.class);
    }
}
